<template>
    <div>
        <detail-banner
                :sightName="sightName"
                :bannerImg="bannerImg"
                :galleryImgs="galleryImgs"
        ></detail-banner>
        <detail-header></detail-header>
        <detail-list :categoryList="categoryList"></detail-list>
        <div class="content"></div>
    </div>
</template>

<script>
    import DetailBanner from './components/Banner'
    import DetailHeader from './components/Header'
    import DetailList from './components/List'
    import axios from 'axios'

    export default {
        name: "Detail",
        components: {
            DetailBanner,
            DetailHeader,
            DetailList
        },
        data (){
            return {
                sightName: '',
                bannerImg: '',
                galleryImgs: [],
                categoryList: [],
            }
        },
        methods: {
            getDetailInfo(){
                axios.get('/mock/detail.json?id',{
                    params: {
                        id: this.$route.params.id
                    }
                })
                    .then(this.getDetailInfoSucc)
            },
            getDetailInfoSucc(res){
                if(res.data.ret && res.data.data){
                    var data = res.data.data;
                    console.log(data)
                    this.sightName = data.sightName;
                    this.bannerImg = data.bannerImg;
                    this.galleryImgs = data.gallaryImgs;
                    this.categoryList = data.categoryList;
                }
            }
        },
        mounted (){
            this.getDetailInfo();
        },
        activated (){
            this.getDetailInfo();
        }
    }
</script>

<style lang="stylus" scoped>
    .content
        height 50rem
</style>

